package com.watchmen.mini.common.utils;


import java.io.Serializable;


public class Result implements Serializable {
    private static final long serialVersionUID = 9011311991851772422L;

	private String code;

	private String message;

	private Object data;

	private String token;

	private Long expire;  //当前token过期时间


	
	public Result(){
		this.code = ErrorMsg.SUCCESS.getCode(); 
		this.message = ErrorMsg.SUCCESS.getMessage();
	}
	
	public Result(ErrorMsg errorMsg){
        this(errorMsg.getCode(),errorMsg.getMessage());
    }

    public Result(Object data){
       this.data = data;
       this.code = ErrorMsg.SUCCESS.getCode();
       this.message = ErrorMsg.SUCCESS.getMessage();
    }
	
	public Result(ErrorMsg errorMsg,Object data){
		this.code = errorMsg.getCode(); 
		this.message = errorMsg.getMessage();
		this.data = data;
	}
	
	public Result(String code,String message){
		this.code = code;
		this.message = message;
	}

    public Result(String code,String message,Object data){
        this.code = code;
        this.message = message;
        this.data = data;
    }

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}  
	
	public String getToken() {
		return token;
	}

	public void setToken(String token) {
		this.token = token;
	}

    public Long getExpire() {
        return expire;
    }

    public void setExpire(Long expire) {
        this.expire = expire;
    }

    public void setError(ErrorMsg errorMsg){
        this.code = errorMsg.getCode();
        this.message = errorMsg.getMessage();
    }
}
